#!/usr/bin/python

import socket
import sys

if len(sys.argv) > 1:
    port = int(sys.argv[1])
else:
    port = 9999
sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
sock.bind(('',port))
sock.listen(1)

conn, client = sock.accept()
print (client)
while 1:
    data = conn.recv(1024)
    if not data:
        break
    print data
    conn.send('Ok\r\n')

conn.close()
